import axios from "axios";
import {
	iceGetStorage
} from "../../utils/common";
import CryptoJS from 'crypto-js';
import { API_URL } from "../api/config";

const iceAxiosRequest = ({
	url,
	method,
	data
}) => {
	return new Promise((resolve, reject) => {
		let header = {
			method: method,
			url: API_URL + url,
			data: data,
		}
		axios(header).then(response => {
			if (response.data.code == 1) {
				reject(response.data.msg);
				// uni.showToast({
				// 	title: response.data.msg,
				// })
			} else {
				resolve(response.data);
			}
			
		}).catch(error => {
			reject(error);
			// uni.showToast({
			// 	title: response.data.msg,
			// })
		});
	});
}
export default iceAxiosRequest